using Microsoft.AspNetCore.Mvc;

namespace Payment.Api.Controllers;

[ApiController]
[Route("api/v1/[controller]")]
public class PaymentController(ILogger<PaymentController> logger) : ControllerBase
{
    [HttpGet]
    public IActionResult Get()
    {
        logger.LogInformation("Payment service called");
        return Ok(new { 
            Service = "Payment Service", 
            Message = "Hello from Payment Service!", 
            Timestamp = DateTime.UtcNow 
        });
    }

    [HttpPost("process")]
    public IActionResult ProcessPayment([FromBody] dynamic paymentRequest)
    {
        logger.LogInformation("Processing payment");
        return Ok(new { 
            Message = "Payment processed successfully", 
            PaymentId = Guid.NewGuid(),
            Status = "Success",
            ProcessedAt = DateTime.UtcNow 
        });
    }

    [HttpPost("refund")]
    public IActionResult ProcessRefund([FromBody] dynamic refundRequest)
    {
        logger.LogInformation("Processing refund");
        return Ok(new { 
            Message = "Refund processed successfully", 
            RefundId = Guid.NewGuid(),
            Status = "Success",
            ProcessedAt = DateTime.UtcNow 
        });
    }
}
